Total Complexity | 2 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import {Inject} from '@nestjs/common'; |
||
8 | |||
9 | export class HolidayToEventsConverter { |
||
10 | constructor( |
||
11 | @Inject('IEventRepository') |
||
12 | private readonly eventRepository: IEventRepository |
||
13 | ) {} |
||
14 | |||
15 | public async convert(holiday: Holiday): Promise<void> { |
||
16 | const events: Event[] = []; |
||
17 | const type = |
||
18 | holiday.getLeaveType() === HolidayLeaveType.MEDICAL |
||
19 | ? EventType.MEDICAL_LEAVE |
||
20 | : EventType.HOLIDAY; |
||
21 | |||
22 | events.push(new Event(type, holiday.getUser(), 100, '2020-01-01')); |
||
23 | |||
27 |